<?php
!defined('P_W') && exit('Forbidden');

L::loadClass('upload', '', false);

class IdcardUpload extends uploadBehavior {
	
	var $db;
	var $uid;
	var $ifftp;
	var $pathname;
	


	function IdcardUpload($uid) {
		global $db,$db_ifftp;
		parent::uploadBehavior();
		$this->uid = (int)$uid;
		$this->db =& $db;
		$this->ifftp = $db_ifftp;	
		$this->ftype = array(
			'gif'  => 2000,				'jpg'  => 2000,
			'jpeg' => 2000,				'bmp'  => 2000,
			'png'  => 2000
		);
	}

	function allowType($key) {
		return true;
	}

	


	function getFilePath($currUpload) {
		$filename	= $this->uid.'_'.'idcard.'. $currUpload['ext'];
		$savedir	= 'idcard/';
		$this->pathname = $this->getServerPath($filename,$savedir);
		return array($filename, $savedir, '', '');
	}

	
	function update($uploaddb) {

	}

	function getServerPath($filename, $dir) {
		global $db_attachname;
		if ($this->ifftp) {
			$source = D_P . "data/tmp/{$filename}";
		} else {
			$source = $db_attachname . '/' . $dir . $filename;
		}
		return $source;
	}
}
?>